package io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class FileCopy3 {

	public static void main(String[] args) {
		try(FileInputStream fis = new FileInputStream("D:\\LearnJava8\\java8s4\\pic1.png");
			FileOutputStream fos = new FileOutputStream("D:\\LearnJava8\\java8s4\\pic2.txt")) {
			byte[] data = new byte[1024];
			int length = 0;
			while ( (length = fis.read(data, 0, data.length)) != -1) {
				fos.write(data, 0, length);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}	
	}
}
